<!DOCTYPE html>
<html>
<script type="text/javascript" src="__STATIC__/plugs/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <title>微信扫码登录</title>
</head>
<body>
<div style="text-align:center;">
	1、请将下图二维码截图保存到手机
</div><br />
<div style="text-align:center;">
	<img src="{$url}" />
</div><br />
<div style="text-align:center;">
	2、打开微信的扫一扫识别上方二维码
</div><br />
<div style="text-align:center;">
	3、点击同意完成微信绑定
</div><br />


<script>
    var t = '';
	$(document).ready(function () {
		queryCheck();
	});

    // 检查完成
    function queryCheck() {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "{:url('api/login/checkwxlogin')}",
            timeout: 10000, //ajax请求超时时间10s
            data: {suijima:"{$suijima}"}, //post数据
            success: function (res, textStatus) {
                //从服务器得到数据，显示数据并继续查询
				console.log(res);
                clearTimeout(t);
                if (res.code!=1) {

                        t=setTimeout(queryCheck, 3000);

                } else {
                    location.href = "{:url('index/index/index')}";
                }
            },
            //Ajax请求超时，继续查询
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                if (textStatus == "timeout") {
                    t=setTimeout(queryCheck, 3000);
                } else { //异常
                    t=setTimeout(queryCheck, 3000);
                }
            }
        });
        return true;
    }
</script>
</body>
</html>